package com.ccb.jyzx.expand.tiantouonline.view.result;

/**
 * @projectName: extend
 * @author: jianghaolin
 * @date: 2019/11/19
 * @version: 1.0
 */
public class ResultUtil {

    public static Result success(Object object) {
        Result result = new Result();
        result.setCode(0);
        result.setMsg("成功");
        result.setData(object);
        return result;
    }
    public static Result success(int code,Object object) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg("成功");
        result.setData(object);
        return result;
    }

    public static Result success() {
        return success(null);
    }


    public static Result error(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(null);
        return result;
    }

    public static Result error(String msg) {
        return  error(-1,msg);
    }
    public static Result error() {
        return  error(-1,"操作失败！");
    }
}
